class Jsq():
    def add(self,a1,a2):
        a=a1+a2
        return a
    def subtract(self,a1,a2):
        a=a1-a2
        return a
    def multiply(self,a1,a2):
        a=a1*a2
        return a
    def divide(self,a1,a2):
        a=a1/a2
        return a
import xlrd
def a(i,a,b,c):
    from xlutils import copy
    # 读取工作簿
    wb = xlrd.open_workbook(r"..\计算机.xls",formatting_info=True)
    # 复制工作簿
    wb_copy = copy.copy(wb)
    # 获取工作表
    ws_copy = wb_copy.get_sheet(i)
    # 写入内容
    ws_copy.write(a,b,c)
    # 保存工作簿
    wb_copy.save(r"..\计算机.xls")
import xlrd
def read_from_excel(index):
    # 打开excel（工作簿）
    wb = xlrd.open_workbook(r"..\计算机.xls")  # 打开工作簿
    ws = wb.sheet_by_index(index)  # 打开学生表
    nrows = ws.nrows  # 获取行数
    data = []
    for i in range(1,nrows):
        data.append(ws.row_values(i))
    return data
data=read_from_excel(0)
for i in range(len(data)):#加
    x=data[i][0]+data[i][1]
    a(0,i+1,3,x)
    if x==data[i][2]:
        a(0,i+1,4,"是")
    else:
        a(0, i + 1, 4, "否")
data=read_from_excel(1)
for i in range(len(data)):#减
    x=data[i][0]-data[i][1]
    a(1,i+1,3,x)
    if x==data[i][2]:
        a(1,i+1,4,"是")
    else:
        a(1, i + 1, 4, "否")
data=read_from_excel(2)
for i in range(len(data)):#乘
    x=data[i][0]*data[i][1]
    a(2,i+1,3,x)
    if x==data[i][2]:
        a(2,i+1,4,"是")
    else:
        a(2, i + 1, 4, "否")
data=read_from_excel(3)
for i in range(len(data)):#除
    x=data[i][0]/data[i][1]
    a(3,i+1,3,x)
    if x==data[i][2]:
        a(3,i+1,4,"是")
    else:
        a(3, i + 1, 4, "否")